package com.sig.map;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

import android.annotation.SuppressLint;
import android.util.Log;
import android.util.SparseArray;

import com.sig.formes.Forme;
import com.sig.formes.IForme;
import com.sig.formes.Polyedre;
import com.sig.formes.Segment;

@SuppressLint("UseSparseArrays")
public class Map {
	HashMap<Integer,Polygone> polygones = new HashMap<Integer,Polygone>();
	HashMap<Integer,Chemin> chemins = new HashMap<Integer,Chemin>();

	public List<IForme> getFormes(){
		List<IForme> formes = new ArrayList<IForme>();

		for(Entry<Integer,Polygone> entry : polygones.entrySet()) {
			Polygone polygone = entry.getValue();

			Log.d("MAP",polygone.toString());

			Polyedre polyedre = new Polyedre(polygone.getPoints(), Forme.bleu);
			formes.add(polyedre);
		}

		for(Entry<Integer,Chemin> entry : chemins.entrySet()) {
			Chemin chemin = entry.getValue();

			Log.d("MAP",chemin.toString());

			Segment segment = new Segment(chemin.getPoint1(), chemin.getPoint2());
			formes.add(segment);				
		}

		return formes;
	}

	public HashMap<Integer, Polygone> getPolygones() {
		return polygones;
	}

	public void setPolygones(HashMap<Integer, Polygone> polygones) {
		this.polygones = polygones;
	}

	public HashMap<Integer, Chemin> getChemins() {
		return chemins;
	}

	public void setChemins(HashMap<Integer, Chemin> chemins) {
		this.chemins = chemins;
	}

	public void addPolygone(Polygone polygone){
		polygones.put(polygone.getId(),polygone);
	}

	public void addChemin(Chemin chemin){
		chemins.put(chemin.getId(),chemin);
	}

}
